<template>
  <div class="progress-chart" ref="progressChartRef">ProgressChart</div>
</template>

<script lang="ts">
export default {
  name: "ProgressChart",
};
</script>

<script lang="ts" setup>
import * as echarts from "echarts";
import { onMounted, ref } from "vue";

const progressChartRef = ref();

onMounted(() => {
  const myEchart = echarts.init(progressChartRef.value);
  const option = {
    xAxis: {
      show: false,
      min: 0,
      max: 100,
    },
    yAxis: {
      data: ["进度"],
      show: false,
    },
    series: {
      type: "bar",
      data: [35],
      barWidth: 10,
      showBackground: true,
      itemStyle: {
        color: "yellowgreen",
      },
      label: {
        // 显示的内容
        show: true,
        formatter: "|",
        position: "right",
        color: "yellowgreen",
      },
    },
    grid: {
      left: 0,
      right: 0,
      top: 0,
      bottom: 0,
    },
  };
  myEchart.setOption(option);
});
</script>

<style scoped>
.progress-chart {
  width: 100%;
  height: 100%;
}
</style>
